<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
                <html lang="zh-CN">
                <head>
                    <meta charset="utf-8">
                    <meta http-equiv="X-UA-Compatible" content="IE=edge">
                    <meta name="viewport" content="width=device-width, initial-scale=1">
                    <title>CMS管理系统</title>

                    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
                    <link rel="stylesheet" href="/Public/css/common.css">
                    
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/Public/select2/css/select2.min.css">
    <link rel="stylesheet" type="text/css" href="/Public/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
    <link rel="stylesheet" type="text/css" href="/Public/bootstrap-datepicker/css/bootstrap-datepicker3.min.css">

                </head>
                <body>

                <nav class="navbar navbar-default navbar-fixed-top col-md-10">
                    <div class="container-fluid nav_bg">
                        <!-- Brand and toggle get grouped for better mobile display -->
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                            <a class="navbar-brand" href="<?php echo U('Index/index');?>">首页</a>
                        </div>

                        <!-- Collect the nav links, forms, and other content for toggling -->
                        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                            <ul class="nav navbar-nav">
                                <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
                                <li><a href="<?php echo U('Link/index');?>">友情链接管理</a></li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                                       aria-expanded="false">前端文件管理 <span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="<?php echo U('File/index');?>">文件管理</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="<?php echo U('Article/show');?>">Finder</a></li>
                                    </ul>
                                </li>

                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                                       aria-expanded="false">内容管理 <span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="<?php echo U('Article/index');?>">文章列表</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="<?php echo U('Category/index');?>">栏目管理</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="<?php echo U('Movie/add');?>">影片管理</a></li>
                                    </ul>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                                       aria-expanded="false">影片管理 <span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="<?php echo U('Movie/add');?>">增加影片</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="<?php echo U('Movie/edit');?>">编辑影片</a></li>
                                    </ul>
                                </li>

                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                                       aria-expanded="false"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> 系统设置 <span
                                            class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="<?php echo U('System/config');?>">站点信息</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="<?php echo U('User/password_edit');?>">密码修改</a></li>
                                    </ul>
                                </li>

                            </ul>


                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="<?php echo U('File/destroy_cache');?>">清除缓存</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">尊敬的<?php echo ($user["username"]); ?> <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="<?php echo U('User/logout');?>">安全退出</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<div class="container-fluid">
    


    <div class="row">
        <div class="col-md-10">
            <div class="panel panel-default">
                <div class="panel-heading">新增文章</div>

                <div class="panel-body">
                    <div class="bs-example" data-example-id="simple-horizontal-form">
                        <form class="form-horizontal" method="post" action="<?php echo U('store');?>">
                            <div class="form-group">
                                <label  class="col-sm-2 control-label">影片类型</label>
                                <div class="col-sm-6">

                                    <select class="form-control" name="type" >
                                        <?php if(is_array($types)): $i = 0; $__LIST__ = $types;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$t): $mod = ($i % 2 );++$i;?><option value="<?php echo ($t["id"]); ?>"><?php echo ($t["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>

                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-2 control-label">影片风格</label>
                                <div class="col-sm-6">

                                    <select class="form-control" name="style" >
                                        <?php if(is_array($styles)): $i = 0; $__LIST__ = $styles;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$s): $mod = ($i % 2 );++$i;?><option value="<?php echo ($s["id"]); ?>"><?php echo ($s["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>

                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-sm-2 control-label">地区</label>
                                <div class="col-sm-6">

                                    <select class="form-control" name="region" >
                                        <?php if(is_array($regiones)): $i = 0; $__LIST__ = $regiones;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$r): $mod = ($i % 2 );++$i;?><option value="<?php echo ($r["id"]); ?>"><?php echo ($r["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">片名</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" name="name" id="name"  >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">发布时间</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" name="date" id="time" placeholder="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">Description Field</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" name="field" id="field" placeholder="field" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">摘要</label>
                                <div class="col-sm-6">
                                    <textarea class="form-control" rows="5" name="zaiyao"></textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">缩略图</label>
                                <div class="col-sm-10 ">
                                    <span class="col-sm-5">
                                    <input type="text" class="form-control " id="thumb1" name="thumb">
                                    </span>
                                    <input type="button"  value="上 传" onclick="BrowseServer('thumb1','img_show1')" class=" btn btn-success" />
                                    <input type="button" value="删 除" class=" thumb_del1 btn btn-danger">
                                    <img src="" class="col-sm-2"id="img_show1" width="90px" height="90px" />

                                </div>
                            </div>




                            <div class="form-group">
                                <label class="col-sm-2 control-label">内容</label>
                                <div class="col-sm-10 ">
                                    <textarea name="content" class="content" rows="10" id="textarea" style="width: 60%;"></textarea>
                                </div>
                            </div>



                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" class="btn btn-default">提交</button>
                                    <button type="button" class="btn btn-default">返回</button>
                                </div>
                            </div>
                        </form>
                    </div>


                </div>
            </div>
        </div>
    </div>



</div>
<script src="/Public/js/jquery.min.js"></script>

<script src="/Public/bootstrap/js/bootstrap.min.js"></script>





    <script type="text/javascript" src="/Public/select2/js/select2.min.js"></script>
    <script type="text/javascript" src="/Public/select2/js/i18n/zh-CN.js"></script>
    <script type="text/javascript" src="/Public/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
    <script type="text/javascript" src="/Public/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
    <script type="text/javascript" src="/Public/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <script src="/Public/ckeditor/ckeditor.js"></script>
    <script src="/Public/ckfinder/ckfinder.js"></script>

    <script type="text/javascript">
        $(function () {
            $('select').select2();
            $('#cp2').colorpicker();
            $('#time').datepicker({
                format: "yyyy-mm-dd",
                language: "zh-CN"
            });
        });
        CKEDITOR.replace('category_content',
                {
                    filebrowserBrowseUrl: '/Public/ckfinder/ckfinder.html',
                    filebrowserImageBrowseUrl: '/Public/ckfinder/ckfinder.html?type=Images',
                    filebrowserFlashBrowseUrl: '/Public/ckfinder/ckfinder.html?type=Flash',
                    filebrowserUploadUrl: '/Public/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                    filebrowserImageUploadUrl: '/Public/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                    filebrowserFlashUploadUrl: '/Public/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
                });



        //ajaxfileupload
        function BrowseServer(thumb, img_show) {
            var finder = new CKFinder();
            finder.selectActionFunction = function(fileUrl){

                $("#"+thumb).val(fileUrl);
                $("#"+img_show).attr("src",""+fileUrl+"");
            } //当选中图片时执行的函数
            finder.popup();//调用窗口
        }

        $(".thumb_del").click(function(){
            $("#thumb").val('');
            $("#img_show").attr("src",'');
        });





        $(".submit").click(function(){
            var title = $(".title");

            if(title.val() == '') {
                alert("标题不能为空！");
                title.focus();
                return false;
            }
//        if(CKEDITOR.instances.editor1.getData() == '') {
//            alert("内容不能为空！");
//            content.focus();
//            return false;
//        }
            var type = $("#select").find("option:selected").attr("data-type");
            if (type == 'no_add') {
                alert("您所选择的栏目是封面栏目，不能添加文章！");
                return false;
            }
        })


        function BrowseServerFile(file) {
            var finder = new CKFinder();
            finder.selectActionFunction = function(fileUrl){

                $("#"+file).val(fileUrl);
            } //当选中图片时执行的函数
            finder.popup();//调用窗口
        }



        //删除缩略图输入框
        $(document).on('click','.file_del',function () {
            $(this).parent().parent().remove();
        });
        $(".file_del1").click(function(){
            $("#file1").val('');
        });


    </script>

</body>
</html>